package com.yznote.cloudesk.message.mapper;

import com.yznote.cloudesk.common.pojo.Room;
import com.yznote.cloudesk.common.pojo.RoomUser;
import com.yznote.cloudesk.common.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
@Component
public interface RoomMapper {
    Integer createRoom(Room room);

    List<Room> queryRoomList(Long userId);

    Integer createRoomUser(RoomUser roomUser);
    List<Long> queryRoomUserIdList(Long roomId);

    Room getRoomById(Long roomId);

    Integer joinRoom(RoomUser roomUser);

    List<Room> queryRoomListByName(String roomName);

    RoomUser getRoomUserByRoomIdAndUserId(Long roomId, Long userId);

    Integer inviteUserTwice(Long roomId, Long userId);

    List<Room> queryInvite(Long userId);

    Integer acceptUserToRoom(Long roomId, Long userId);

    Integer removeUserFromRoom (Long roomId, Long userId);

    Integer joinRoomTwice(Long roomId, Long userId);

    Integer joinTheRoom(RoomUser roomUser1);

    List<RoomUser> queryApply(Long userId);

    List<RoomUser> queryApplyByRoomId(Long userId, Long roomId);

    List<User> selectUsersInRoom(Long roomId);

    Integer inviteUser(RoomUser roomUser);

    List<Room> getInviteNotice(Long userId);

    List<Room> getOwnerRoomList(Long userId);

    Integer rejectInvite(Long roomId, Long userId);

    Integer updateReadTime(LocalDateTime time, Long userId,Long roomId);

    Integer dismissRoom(Long roomId, Long userId);

    int tryJoinRoom(RoomUser roomUser);

}
